Helloword.py

>>> f = open('data.txt') >>> text = f.read() >>> text 'Hello\nworld\n' >>> print(text) Hello world >>> text.split() ['Hello', 'world'] # 'r' (read) is the default processing mode # Read entire file into a string # print interprets control characters # File content is always a string
Test text Python

1 Response

Run Code Python 3.3
Python (command line)
C:\code> python Helloword.py
View
Hello world

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.