In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about what the code commonly used by beginners in Python code is, which may not be well understood by many people. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
Mainly record some code commonly used by beginners:
1. Get the current time
#-*-coding: gbk-*-import os import time import shutil today = time.strftime ('% Y-%m-%d week% w') now = time.strftime ('% HV% MVD% S') >
Common properties of 2.os.path
Os.path.sep: path separator. I used to use'/', but then I used'/'.
Os.path.altsep: (root directory, I'm not sure, I use it as root directory. Anyway, the performance in windows is'/')
Os.path.curdir: current directory
Os.path.pardir: parent directory
3. Determine whether it is a specified file type
File.rsplit ('.', 1) [- 1] = = type
Of course, it can be written as
File.split ('.') [- 1:] [0] = = type after reading the above, do you have any further understanding of what is commonly used by beginners in Python code? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.