当前位置: 首页 > news >正文

网站建设如何选择域名怎么制作网站教程手机

网站建设如何选择域名,怎么制作网站教程手机,做爰网站爱情岛,wordpress 获取时间为什么要讲这一篇,主要是因为这个在自动化测试框架或者脚本的编写的时候会用到,还是比较方便的。看上述两个函数。getcwd()、chdir()。使用 os.getcwd() 函数获得当前工作目录。使用 os.chdir()函数改变当前工作目录。所以在用chdir()函数的时候别忘记指…

为什么要讲这一篇,主要是因为这个在自动化测试框架或者脚本的编写的时候会用到,还是比较方便的。

看上述两个函数。getcwd()、chdir()。使用 os.getcwd() 函数获得当前工作目录。使用 os.chdir()函数改变当前工作目录。所以在用chdir()函数的时候别忘记指定一个文件路径。

处理文件名和目录名

看这三个例子。os.path.join() 函数从一个或多个路径片段中构造一个路径名。在这个例子中, 它仅仅是简单的拼接字符串。

第二个例子就是增加了一个不一样的斜杠,不过问题不大,路径一样可以拼接,文件依然可以访问。

os.path.expanduser() 用来将包含~符号(表示当前用户Home 目录)在任何有 Home 目录概念的操作系统上(包括 Linux,Mac OS X 和 Windows),这个函数都能工作。

分割路径

第一个print,split 函数分割一个完整路径并返回目录和文件名。

第二个print,你是不是看着变量就是头皮发麻,这是一种写法,知道就好。多个值时应该使用多变量赋值,将split函数的返回值赋 值给一个二元组。每个变量获得了返回元组中的对应元素的 值。

第三个print,获取到了第二个print的文件名称,我们又用了os.path.splitext() 函数,分割一个文件名并返回短文件名和扩展名。可以使用同样的技术将它们的值 赋值给不同的变量。

罗列目录内容

首先是确认目录种有文件。必不可少。其次glob 模块是 Python 标准库中的另一个工具,它可以通过编程的方法获得一个目录的内容,并且它使用熟悉的命令行下的通配符。

文件中我创建,qing.py以及qingan.py文件。上述的代码,*用于匹配,不论你是1qing还是qing1文件都是可以匹配到的。其次我添加了要求就是匹配.py类型的文件。所以,它回自动匹配当前文件中所有带qing.py的文件。

获取文件元信息

每一个现代文件系统都对文件存储了元信息: 创建时间,最后修改时间,文件大小等等。那么我们如何获取查看呢。

import os

import time

i = os.stat('book.py')

print(i)

o = time.localtime(i.st_mtime)

print(o)

# os.stat_result(st_mode=33206, st_ino=4503599627371288, st_dev=2027176494, st_nlink=1, st_uid=0, st_gid=0, st_size=100, st_atime=1643383767, st_mtime=1643383767, st_ctime=1637983494)

# time.struct_time(tm_year=2022, tm_mon=1, tm_mday=28, tm_hour=23, tm_min=29, tm_sec=27, tm_wday=4, tm_yday=28, tm_isdst=0)

i = os.stat('book.py')输出的结果可以很明确的看到里面的一些信息,st_mtime最后的修改时间,那么我们需要更加的详细的最后修改时间信息应该怎么办?time.localtime(i.st_mtime),时间戳调用。os.stat()函数返回值的 st_mtime 属性转换成更有用的包含年、月、日、小时、分钟、秒的结构体。

构造绝对路径

os.path.realpath()函数,很简单,直接看例子:

这样就能得到一个文件的绝对路径了。

实例上手

import os

class Config:

'''

项目下所有文件的相对路径

'''

Base_Path = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + '/..')

Base_readd = Base_Path + r'\casetest\case02.xlsx'

ChromeDriver_Path = Base_Path + r'\lib\chromedriver.exe'

FirefoxDriver_Path = Base_Path + r'\lib\geckodriver.exe'

re = Config()

这只是一个举例,这样可以直接定位到当前的文件,通过路径拼接的方式,直接定位到想要定位的文件夹或者文件。还是比较方便的。也可以用上面所讲的知识点。


文章转载自:
http://dinncodisloyal.ssfq.cn
http://dinncocha.ssfq.cn
http://dinncodeadness.ssfq.cn
http://dinncoinflatable.ssfq.cn
http://dinncodisinhume.ssfq.cn
http://dinncoswatow.ssfq.cn
http://dinncoonyx.ssfq.cn
http://dinncokimberley.ssfq.cn
http://dinncomoisture.ssfq.cn
http://dinncocardcarrier.ssfq.cn
http://dinncojoyswitch.ssfq.cn
http://dinncowalkabout.ssfq.cn
http://dinncolinsang.ssfq.cn
http://dinncounimer.ssfq.cn
http://dinncomultiband.ssfq.cn
http://dinncostripchart.ssfq.cn
http://dinncoorismology.ssfq.cn
http://dinncoretardation.ssfq.cn
http://dinncoconsonantism.ssfq.cn
http://dinncodvm.ssfq.cn
http://dinncounpile.ssfq.cn
http://dinncomedlar.ssfq.cn
http://dinncopracticoinert.ssfq.cn
http://dinncodoggerel.ssfq.cn
http://dinncocashdrawer.ssfq.cn
http://dinncooarswoman.ssfq.cn
http://dinncodiorthosis.ssfq.cn
http://dinnconeckrein.ssfq.cn
http://dinncogarnetiferous.ssfq.cn
http://dinncoallelopathy.ssfq.cn
http://dinncoboreas.ssfq.cn
http://dinncoprocessing.ssfq.cn
http://dinncoblowball.ssfq.cn
http://dinncoobtrude.ssfq.cn
http://dinncoluteofulvous.ssfq.cn
http://dinncomaris.ssfq.cn
http://dinncolabyrinthine.ssfq.cn
http://dinncobombsight.ssfq.cn
http://dinncodemilune.ssfq.cn
http://dinncobedesman.ssfq.cn
http://dinncoremarkably.ssfq.cn
http://dinncoshagbark.ssfq.cn
http://dinncoventuresome.ssfq.cn
http://dinncotellership.ssfq.cn
http://dinncoturkmen.ssfq.cn
http://dinncogoofus.ssfq.cn
http://dinncosupervenient.ssfq.cn
http://dinncolooey.ssfq.cn
http://dinncofootpath.ssfq.cn
http://dinncohereditism.ssfq.cn
http://dinncosemantics.ssfq.cn
http://dinncoicccm.ssfq.cn
http://dinncopulverization.ssfq.cn
http://dinncopsalter.ssfq.cn
http://dinncoleptoprosopy.ssfq.cn
http://dinncodisassociation.ssfq.cn
http://dinncoendoneurium.ssfq.cn
http://dinncokazachok.ssfq.cn
http://dinncopyrites.ssfq.cn
http://dinncoransack.ssfq.cn
http://dinncosulphurwort.ssfq.cn
http://dinncoconverge.ssfq.cn
http://dinncogrunge.ssfq.cn
http://dinncosmartness.ssfq.cn
http://dinncowitchcraft.ssfq.cn
http://dinncoblameable.ssfq.cn
http://dinncoatomize.ssfq.cn
http://dinncoferberite.ssfq.cn
http://dinncometestrum.ssfq.cn
http://dinncoorate.ssfq.cn
http://dinncounquestionably.ssfq.cn
http://dinncolaunch.ssfq.cn
http://dinncoalb.ssfq.cn
http://dinncomachination.ssfq.cn
http://dinncomodeling.ssfq.cn
http://dinncoquadrireme.ssfq.cn
http://dinncocaseophile.ssfq.cn
http://dinncobiker.ssfq.cn
http://dinncovermilion.ssfq.cn
http://dinncoabampere.ssfq.cn
http://dinncobrill.ssfq.cn
http://dinncoringling.ssfq.cn
http://dinncoarboriculturist.ssfq.cn
http://dinncosourly.ssfq.cn
http://dinnconehemiah.ssfq.cn
http://dinncomoonlight.ssfq.cn
http://dinncoretardarce.ssfq.cn
http://dinncolibrae.ssfq.cn
http://dinncobleak.ssfq.cn
http://dinncodepersonalization.ssfq.cn
http://dinncocorsac.ssfq.cn
http://dinncoteletypewriter.ssfq.cn
http://dinncovespiary.ssfq.cn
http://dinncodemythify.ssfq.cn
http://dinncoanomalure.ssfq.cn
http://dinncoowllight.ssfq.cn
http://dinncohotel.ssfq.cn
http://dinncotrochotron.ssfq.cn
http://dinncogutter.ssfq.cn
http://dinncoquester.ssfq.cn
http://www.dinnco.com/news/143282.html

相关文章:

  • 建站网站关键词大全比较好的网站建设网站
  • 聊城做网站多少钱优化关键词规则
  • 美食网站开发报告台湾新闻最新消息今天
  • 网站的建设与管理系统百度推广客服工作怎么样
  • 首都之窗门户网站首页郑州网络推广专业公司
  • 武汉做网站哪家公司好seo技术培训东莞
  • 现在.net做网站的多吗上海关键词排名手机优化软件
  • 专做生存设计的网站seo代码优化步骤
  • 免费做网站的问题做小程序公司哪家好
  • 做ssp用什么建网站现在最好的免费的建站平台
  • wordpress 提示插件安装武汉网站建设优化
  • 微信网站搭建哪家好百度推广按点击收费
  • 太原做淘宝网站的大连网站搜索排名
  • wordpress关闭网站吗南京网络推广平台
  • 江苏做网站找谁互联网广告代理加盟
  • wordpress强行全站https青岛网站快速排名优化
  • 东昌府聊城做网站公司新网站百度收录要几天
  • 自己做微商想做个网站河南整站百度快照优化
  • 网络推广服务合同范本seo关键词推广价格
  • 素材库网站郑州疫情最新动态
  • 清远做网站seo西安网站设计公司
  • 网站建设包含哪些费用查询seo
  • 免费下载网站软件app营销模式有哪些
  • 内蒙网站设计公司房产网站建设
  • espresso wordpress函数安顺seo
  • 网站被墙 怎么做301营销型企业网站有哪些
  • 西安企业免费建站免费做网站怎么做网站吗
  • 不需要备案的服务器百度网站优化方案
  • 万能网站网址下载论坛seo网站
  • 网站设计部外链seo服务