1.字符串大小写转换string.title()#将字符串中所有单词的首字母以大写形式显示string.upper()#将字符串中所有字母转化为大写字母string.lower()#将字符串中所有字母转化为小写字母str="helloworld!"print(str.title())HelloWorld!print(str.upper())HELLOWORLD!print(str.lower())helloworld!2.字符拼接python中只用使用'+
系统 2019-09-27 17:50:30 1923
阅读更多pipinstallpyecharts;会安装pyecharts-1.1.0画K线图kline1.py#coding:utf-8importos,sysfrompyechartsimportoptionsasoptsfrompyecharts.chartsimportKlineiflen(sys.argv)==2:code=sys.argv[1]else:print('usage:kline1.pycode')sys.exit(1)iflen(co
系统 2019-09-27 17:50:05 1923
这是我在CSDN的第一篇博客,假期刚自学Python,尝试爬取了一下豆瓣top250.希望可以有大佬指点感谢importrequestsfrombs4importBeautifulSoupdefgethtml(url):try:kv={'user-agent':'Mozilla/5.0(WindowsNT10.0;Win64;x64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/59.0.3071.115Safari/
系统 2019-09-27 17:49:53 1923
本文实例讲述了Python实现微信中找回好友、群聊用户撤回的消息功能。分享给大家供大家参考,具体如下:还在好奇好友撤回了什么消息吗?群里撤回了什么消息?下面的代码实现了:即使群、好友撤回了文本消息、表情、图片等消息,自己也能知道撤回的什么。#coding=utf-8importitchatfromitchat.contentimportTEXTfromitchat.contentimport*importsysimporttimeimportreimpor
系统 2019-09-27 17:49:48 1923
Apache配置文件:httpd.conf文件#指定Apache的安装路径,此选项参数值在安装Apache时系统会自动把Apache的路径写入。ServerRoot"/www/server/apache"#Listen主要侦听web服务端口状态,默认为:80,即侦听所有的地址的80端口,注意这里也可以写成IP地址的侦听形式,不写即默认的地址:0.0.0.0Listen106.15.88.162:80Listen80#指定Apache运行用户配置Userww
系统 2019-09-27 17:49:45 1923
1.可传入参数:@app.route('/user/')#常用的不加参数的时候默认是字符串形式的@app.route('/post/')#常用的#指定int,说明是整型的@app.route('/post/')@app.route('/post/')@app.route('/login',methods=['GET','POST'])DEFAULT_CONVERTERS={'default':UnicodeConverter,'string':Unicod
系统 2019-09-27 17:49:32 1923
这里使用pipe代码如下:importtimefrommultiprocessingimportProcessimportmultiprocessingclassD:@staticmethoddeftest(pipe):whileTrue:foriinrange(10):pipe.send(i)time.sleep(2)@staticmethoddeftest2(pipe):whileTrue:print('test2value:%s'%pipe.recv
系统 2019-09-27 17:49:29 1923
本文实例讲述了Python文件的读写操作。分享给大家供大家参考,具体如下:读写文件读取文件f=open('my_path/my_file.txt','r')#open方法会返回文件对象file_data=f.read()#通过read方法获取数据f.close()#关闭该文件首先使用内置函数open打开文件。需要文件路径字符串。open函数会返回文件对象,它是一个Python对象,Python通过该对象与文件本身交互。在此示例中,我们将此对象赋值给变量f。
系统 2019-09-27 17:49:16 1923
frommultiprocessingimportProcess,Queuefromtimeimporttimedeftask_handler(current_list,result_queue):total=0fornincurrent_list:total+=nresult_queue.put(total)defmain():processes=[]number_list=[xforxinrange(1,10000001)]result_queue=Q
系统 2019-09-27 17:48:29 1923
下面是实现代码#coding:utf-8importtime,serialfromstructimport*importbinasciifile=open('E:\\1.bin','rb')i=0while1:c=file.read(1)#将字节转换成16进制;ssss=str(binascii.b2a_hex(c))[2:-1]print(str(binascii.b2a_hex(c))[2:-1])ifnotc:breakser=serial.Seri
系统 2019-09-27 17:48:02 1923