I started Python today. I don't have much knowledge about the program. I would like to summarize the code I studied today.
** String type ** split (","): Splits itself with a specific string (,). index (","): You can see which character (,) specified by the argument appears first.
** datetime module ** In order to read date, time, datetime type module, it is necessary to read by import. This is common to all modules.
** date type ** Today: kyou = datetime.date.today () Find out the day of the week: kyou.weekday ()
** datetime type ** Now: datetime.datetime.now ()
** List type ** list [-1]: Access the last element append: Append element to the end of the list. insert (a, b): Insert b in place of the subscript a. pop (a): Removed the element with the subscript a. remove (a): Remove by specifying element a. extend (list): Add all elements of list. list [0: 3]: Extracts the elements starting from the 0th to the one before the 3rd. sort (): Sort in ascending order. Alphabetical order for letters (uppercase comes first) reverse (): Reverse the order.
** Dictionary type ** Save the key and value as a pair and use the key to recall the value. The format is country_code = {1: "America", 39: "Italia", 86: "China"} The number is the key and the country is the value. Italia can be retrieved with country_code [39].
Thank you very much!
Recommended Posts