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

做网站去哪里创新的企业网站制作

做网站去哪里,创新的企业网站制作,网站建设应计入哪个会计科目,媒体网站怎么做「Author#xff1a;By Runsen」在很多时候#xff0c;你会想要让你的程序与用户(可能是你自己)交互。你会从用户那里得到输入#xff0c;然后打印一些结果。我们可以使用input和print语句来完成这些功能。inputname input(your name:)gender input(you are a boy?(y/n))… 「AuthorBy Runsen」在很多时候你会想要让你的程序与用户(可能是你自己)交互。你会从用户那里得到输入然后打印一些结果。我们可以使用input和print语句来完成这些功能。inputname  input(your name:)gender  input(you are a boy?(y/n))###### 输入 ######your name:Runsenyou are a boy?ywelcome_str  Welcome to the matrix {prefix} {name}.welcome_dic  {    prefix: Mr. if gender  y else Mrs,    name: name}print(authorizing...)print(welcome_str.format(**welcome_dic))########## 输出 ##########authorizing...Welcome to the matrix Mr. Runsen.input函数暂停运行等待键盘输入直到按下回车输入的类型永远时字符串a  input()1b  input()2print(a  b  {}.format(a  b))########## 输出 ##############a  b  12print(type of a is {}, type of b is {}.format(type(a), type(b)))########## 输出 ##############type of a is class str, type of b is class strprint(a  b  {}.format(int(a)  int(b)))########## 输出 ##############a  b  3文件输入和输出生产级别的 Python 代码大部分 I/O 则来自于文件这里有个in.text完成worldcount功能。Mr. Johnson had never been up in an aerophane before and he had read a lot about air accidents, so one day when a friend offered to take him for a ride in his own small phane, Mr. Johnson was very worried about accepting. Finally, however, his friend persuaded him that it was very safe, and Mr. Johnson boarded the plane.His friend started the engine and began to taxi onto the runway of the airport. Mr. Johnson had heard that the most dangerous part of a flight were the take-off and the landing, so he was extremely frightened and closed his eyes.After a minute or two he opened them again, looked out of the window of the plane, and said to his friend。Look at those people down there. They look as small as ants, dont they?Those are ants, answered his friend. Were still on the ground.现在读取文件去掉所有标点和换行符将大写变为小写合并相同的词统计每个词出现的频率将词频从大到小排序将结果按行输出文件out.txtimport re# 你不用太关心这个函数def parse(text):    # 使用正则表达式去除标点符号和换行符    text  re.sub(r[^\w ], , text)    # 转为小写    text  text.lower()        # 生成所有单词的列表    word_list  text.split( )        # 去除空白单词    word_list  filter(None, word_list)        # 生成单词和词频的字典    word_cnt  {}    for word in word_list:        if word not in word_cnt:            word_cnt[word]  0        word_cnt[word]  1        # 按照词频排序    sorted_word_cnt  sorted(word_cnt.items(), keylambda kv: kv[1], reverseTrue)        return sorted_word_cntwith open(in.txt, r) as fin:    text  fin.read()word_and_freq  parse(text)with open(out.txt, w) as fout:    for word, freq in word_and_freq:        fout.write({} {}\n.format(word, freq))########## 输出 (省略较长的中间结果) ##########但是有个问题如果文件非常的大容易造成内存奔溃这个时候给 read 指定参数 size还可以通过 readline() 函数每次读取一行。json文件读取import jsonparams  {    symbol: 123456,    type: limit,    price: 123.4,    amount: 23}params_str  json.dumps(params)print(after json serialization)print(type of params_str  {}, params_str  {}.format(type(params_str), params))original_params  json.loads(params_str)print(after json deserialization)print(type of original_params  {}, original_params  {}.format(type(original_params), original_params))########## 输出 ##########after json serializationtype of params_str  class str, params_str  {symbol: 123456, type: limit, price: 123.4, amount: 23}after json deserializationtype of original_params  class dict, original_params  {symbol: 123456, type: limit, price: 123.4, amount: 23}json.dumps() 这个函数接受 Python 的基本数据类型 字典然后转化string (json的字符串)json.loads() 这个函数接受一个合法字符串(json)然后 转化为字典「json 的读入」import jsonparams  {    symbol: 123456,    type: limit,    price: 123.4,    amount: 23}with open(params.json, w) as fout:    params_str  json.dump(params, fout)with open(params.json, r) as fin:    original_params  json.load(fin)print(after json deserialization)print(type of original_params  {}, original_params  {}.format(type(original_params), original_params))########## 输出 ##########after json deserializationtype of original_params  class dict, original_params  {symbol: 123456, type: limit, price: 123.4, amount: 23}参考https://time.geekbang.org/column/article/96570❝本文已收录 GitHub传送门~[1] 里面更有大厂面试完整考点欢迎 Star。❞Reference[1]传送门~: https://github.com/MaoliRUNsen/runsenlearnpy100今天的文章到这里就结束了如果喜欢本文的话请来一波素质三连给我一点支持吧(关注、在看、点赞)。更多的文章点击下面小程序- END -
http://wiki.neutronadmin.com/news/290471/

相关文章:

  • 专业公司网站开发服务优质ppt模板免费下载
  • php网站建设制作流程响应式网站 cms
  • wordpress全站链接网站ie不兼容
  • 机票网站建设山东潍坊网站制作公司
  • 房屋网站模板wordpress qq微信登陆地址
  • 网站无法导入照片wordpress的使用方法
  • 淄博著名网站开发方法中文在线っと好きだっ
  • 唐山网站建设开发做名片最好的网站
  • 阿里巴巴国际站关键词推广广州哪里有做网站的
  • 东莞什么行业做网站的多太原室内设计公司排名
  • 怎样做机械租赁的网站注册公司最好用老年人
  • 企业展示型电商网站模板招工 最新招聘信息58同城
  • 郑州app网站公司住房和城乡规划建设局官方网站
  • 怎么做网站平台中国十大网络安全公司排名
  • 小程序是怎么制作出来的门户网站做seo
  • 佛山企业网站建设教程微信公众号做电影网站要域名吗
  • 用手机可以做网站吗网站开发安全性分析
  • 有做企业网站的吗creative建网站平台
  • 安宁市建设局网站电子商务的就业方向是什么
  • 北京网站建设公司分享网站改版注意事项北京小程序制作首选华网天下
  • 网站开发音乐做网站江西
  • 网站底部优化文字网销怎么销售的
  • 成都系统网站建设制作网站首先要知道什么
  • 如何开发网站自己做站长罗伯特清崎说的网络营销是什么
  • asp网站图片不显示无锡关键词优化价格
  • 网站在线支付接口申请娃娃修复师的工作主要是什么
  • 中国第四冶金建设有限公司官方网站做网站用什么cms
  • 网站 点击率品牌设计论文题目
  • 上海网站制作网互联网推广平台有哪些公司
  • 企业发展历程网站自己做刷东西的网站