How do I print the content of a .txt file in Python?

前端 未结 9 983
慢半拍i
慢半拍i 2020-12-13 18:28

I\'m very new to programming (obviously) and really advanced computer stuff in general. I\'ve only have basic computer knowledge, so I decided I wanted to learn more. Thus I

9条回答
  •  旧时难觅i
    2020-12-13 19:17

    This will give you the contents of a file separated, line-by-line in a list:

    with open('xyz.txt') as f_obj:
        f_obj.readlines()
    

提交回复
热议问题