If there are new lines in your string, you can paste it into the console as part of a block quote, using """
to mark the beginning and end. As long as each line is under the limit of your system's console (apparently Windows at ~8000) then you should be alright.
Edit: reading data from a file is more or less guaranteed to work, regardless of limitations of your system's console. You can do it with pathlib
(part of the standard library in Python 3) or pathlib2
if you're using python 2
from pathlib import Path
y = Path('path/to/your/file.txt').read_text()
Edit 2: here is a complete example of how you can read this from a text file.
Suppose you have a gigantic number (e.g. a googol) and you put it in a text file named gigantic-number.txt
. The contents of gigantic-number.txt
look like
10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Within a Python console, you can load the contents of that file and then cast it as an integer. Using the example from before with pathlib
>>> from pathlib import Path
>>> # read the contents of the file as a string
>>> y = Path('gigantic-number.txt').read_text()
>>> # convert the string into an integer, this will fail unless it's actually a number
>>> y = int(y)
Some sources of gigantic numbers produce text files that contain line breaks in them. This makes them more readable in simple text editors like Notepad. One example is from GIMPS: M3217.txt
looks like
2591170860132026277762467679224415309418188875531254273039749231618740192665863620862012095168004834
0655069524173319417744168950923880701741037770959751204231306662408291635351795231118615486226560454
7691127595848775610568757931191017711408826252153849035830401185072116424747461823031471398340229288
0745456779079410372882358207058923510684338829868886166586502809276920803396058693087905004095037098
7590211901837199162099400256893511313654882973911265679730324198651725011641270350970542777347797234
9821676443446668383119322540099648994051790241624056519054483690809616061625743042361721863339415852
4264312087372665919620617535357488928945996291951830826218608534009379328394202618665861425032514507
7309627423537682293864940712770084607712421182308080413929808705750471382526457144837937112503208182
6126566649084251699453951887789613650248405739378594599444335231188280123660406262468609212150349937
584782292237144339628858485938215738821232393687046160677362909315071
Building on the example from before, you can read this from a file, remove the whitespace, and then cast as an integer.
>>> from pathlib import Path
>>> from string import digits
>>> # read from file as a string
>>> y = Path('M3217.txt').read_text()
>>> # keep only digit characters and "."
>>> y = ''.join(digit for digit in y if digit in digits+".")
>>> # cast as an integer
>>> int(y)
259117086013202627776246767922441530941...
To be clear, only the number goes in the text file. Your edited question makes it seem like you pasted the Python code into the text file as well which is not going to solve this problem.