python read file
- read entire file at once
- http://stackoverflow.com/questions/7409780/reading-entire-file-in-python
- with open('Path/to/file', 'r') as content_file:
- content = content_file.read()
- line by line
- http://stackoverflow.com/questions/3277503/how-to-read-a-file-line-by-line-into-a-list-with-python
with open(fname) as f: content = f.readlines()
- Trimming a string in Python
- char at
- Indexing, Slicing
- https://www.tutorialspoint.com/python/python_lists.htm
L = ['spam', 'Spam', 'SPAM!']
Python Expression Results Description L[2] 'SPAM!' Offsets start at zero L[-2] 'Spam' Negative: count from the right L[1:] ['Spam', 'SPAM!'] Slicing fetches sections - tokenize
- .split()
댓글
댓글 쓰기