#!/usr/bin/env python3 # String examples ais_19 = 'Uganda' # using single quotes ais_19_city = "Kampala" # using double quotes ais_19_venue = '''Sheraton Hotel''' # using triple quotes print(ais_19_city,ais_19, ais_19_venue) #You have to escape if using single quote in a string of single quotes ais_19_ug = 'AIS\'19 @ Kampala Uganda' #Or use single quote in a string double quote ais_19_sh = "AIS'19 @ Sheraton, Kampala Uganda" print("AIS Host is ", ais_19_ug) print("AIS Venue is ", ais_19_sh) # triple quotes string can extend multiple lines my_string = """\ Usage: IoTNetwork [Options] -h display this message -H hostname hostname to connect to """ print(my_string) prefix = 'Py' postfix = 'thon' print(prefix+postfix) word = 'AfNOG20' print('word:',word) print('word[3]:',word[3]) # get the nth index letter in the string print('word[2:5]:',word[2:5]) # a sub string print('word[:2]:',word[:2]) # get all string before second index letter(excluded) print('word[2:]:',word[2:]) # get all string after second index letter(included)