![]() | Strings apply different types of quotes
s = 'single quotes' s = "double quotes" s = """triple quotes are used for multi-line strings """ s = r'raw strings start with r and backslash \ is preserved' s = '\t\n' # tab + newline s = r'\t\n' # a string with four characters: \t\n |
![]() | Some useful operations:
if sys.platform.startswith('win'): # Windows machine? ... file = infile[:-3] + '.gif' # string slice of infile answer = answer.lower() # lower case answer = answer.replace(' ', '_') words = line.split() |