How do I store the result from reading a text file as a variable?

时间:2015-09-01 21:48:37

标签: python

I'm trying to read from a text document

text_file.readline(2)

Any ideas how I could save the result under a variable?

1 个答案:

答案 0 :(得分:4)

variable = text_file.readline(2)

Perhaps you should read a basic tutorial :).