Ask Your Question

Revision history [back]

Hello,

I would create a file that contains a number and then read it from Sage. To open a file this is a standard python command (see Input and Output from python.org):

sage: f = open("my_file_that_contains_a_big_number.txt")
sage: text = f.read()
sage: f.close()
sage: my_big_number = ZZ(text)

If it is multiple lines you can remove the breaks with

sage: f = open("my_file_that_contains_a_big_number.txt")
sage: text = f.read()
sage: f.close()
sage: text = text.replace("\n", "")
sage: text = text.replace("\r", "")
sage: text = text.replace(" ", "")
sage: my_big_number = ZZ(text)

Vincent