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

如何制作h5做网站百度文章收录查询

如何制作h5做网站,百度文章收录查询,彩票推广网站如何做,政府机关网站备案1.IPython 的帮助文档 使用 help() 使用 ? 使用 ?? tab 自动补全 shift tab 查看参数和函数说明 2.运行外部 Python 文件 使用下面命令运行外部 Python 文件(默认是当前目录,也可以使用绝对路径) %run *.py …

1.IPython 的帮助文档

  • 使用 help()

  • 使用 ?

  • 使用 ??

  • tab 自动补全

  • shift + tab 查看参数和函数说明

2.运行外部 Python 文件

  • 使用下面命令运行外部 Python 文件(默认是当前目录,也可以使用绝对路径)

%run *.py

示例:在当前目录下有一个 myscript.py 文件:

def square(x):   """square a number"""   return x ** 2for N in range(1,4):   print(N, "squared is", square(N))

可以通过下面命令执行:

%run myscript.py# 执行效果1 squared is 12 squared is 43 squared is 9

尤其要注意的是,当我们使用魔法命令执行了一个外部文件时,该文件的函数就能在当前会话中使用

  • 只输出最后一个

square(5)square(6)# 执行结果36
  • a,b只能写在最后一行,以元组输出

a = square(5)b = square(6)a,b# 执行结果(25, 36)
  • 换行分别输出

a = square(5)b = square(6)display(a,b)# 执行结果2536
  • 以打印的方式输出

a = square(5)b = square(6)print(a,b)# 执行结果25 36
  • 导入 myscript.py 文件

import myscript#执行效果1 squared is 12 squared is 43 squared is 9

3.运行计时

  • 用下面命令计算 statement 的运行时间

%time statement# %time:一般用来统计耗时较长代码的运行时长%time square(100)# 执行效果CPU times: total: 0 nsWall time: 0 nsOut[28]:10000
  • 用下面命令统计 statement 的平均运行时间

%timeit statement
  • timeit 会多次运行 statement,最后得到一个更为精准的预期运行时间

%timeit square(100)#执行效果209 ns ± 8.52 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)%timeit -r 3 -n 100 square(100)#执行效果322 ns ± 45.9 ns per loop (mean ± std. dev. of 3 runs, 100 loops each)
  • 可以使用两个百分号来测试多行代码的平均运行时间

%%timeitsquare(100)add(10,20)# 执行效果344 ns ± 5.84 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)
  • 记住

%time  # 一般用于耗时长的代码段%timeit  # 一般用于耗时短的代码段

4.查看当前会话中的所有变量与函数(了解)

  • 快速查看当前会话的所有变量与函数名称

%who# 执行效果N     a     add     b     myscript     numpy     square
  • 查看当前会话的所有变量与函数名称的详细信息

%whos# 执行效果Variable   Type        Data/Info--------------------------------N          int         3a          int         25add        function    <function add at 0x000001AD7CAEE0C0>b          int         36myscript   module      <module 'myscript' from '<...>top\\NumPy\\myscript.py'>numpy      module      <module 'numpy' from 'D:\<...>ges\\numpy\\__init__.py'>square     function    <function square at 0x000001AD7D8F9C60>
  • 返回一个字符串列表,里面元素时当前会话的所有变量与函数名称

%who_ls# 执行效果['N', 'a', 'add', 'b', 'myscript', 'numpy', 'square']

4.安装包

  • 使用 pip 命令安装

pip install numpy

5.更多魔法命令

  • 列出所有魔法命令

lsmagic# 执行效果Available line magics:%alias  %alias_magic  %autoawait  %autocall  %automagic  %autosave  %bookmark  %cd  %clear  %cls  %code_wrap  %colors  %conda  %config  %connect_info  %copy  %ddir  %debug  %dhist  %dirs  %doctest_mode  %echo  %ed  %edit  %env  %gui  %hist  %history  %killbgscripts  %ldir  %less  %load  %load_ext  %loadpy  %logoff  %logon  %logstart  %logstate  %logstop  %ls  %lsmagic  %macro  %magic  %matplotlib  %mkdir  %more  %notebook  %page  %pastebin  %pdb  %pdef  %pdoc  %pfile  %pinfo  %pinfo2  %pip  %popd  %pprint  %precision  %prun  %psearch  %psource  %pushd  %pwd  %pycat  %pylab  %qtconsole  %quickref  %recall  %rehashx  %reload_ext  %ren  %rep  %rerun  %reset  %reset_selective  %rmdir  %run  %save  %sc  %set_env  %store  %sx  %system  %tb  %time  %timeit  %unalias  %unload_ext  %who  %who_ls  %whos  %xdel  %xmodeAvailable cell magics:%%!  %%HTML  %%SVG  %%bash  %%capture  %%cmd  %%code_wrap  %%debug  %%file  %%html  %%javascript  %%js  %%latex  %%markdown  %%perl  %%prun  %%pypy  %%python  %%python2  %%python3  %%ruby  %%script  %%sh  %%svg  %%sx  %%system  %%time  %%timeit  %%writefileAutomagic is ON, % prefix IS NOT needed for line magics.
  • 查看魔法命令的文档:使用?

# 例如查看魔法命令 %run 的文档%run?

http://www.wooajung.com/news/30053.html

相关文章:

  • 徐州人才网seo优化是什么意思
  • 网站开发和c语言上海培训机构白名单
  • 建设网站需求seo的作用是什么
  • 石龙网站设计创建自己的网页
  • 海南网站建设优化排名百度搜索榜
  • 杭州 网站制作公众号推广合作平台
  • 珠海微信网站开发谷歌账号
  • 支付招聘网站套餐费用怎么做帐百度惠生活怎么做推广
  • 高大上强企业网站站长平台
  • php网站建设流程图济南公司网站推广优化最大的
  • 一键生成器seo网课培训
  • 播放视频网站怎么做seo网站优化网站编辑招聘
  • 个人做的网站有什么危险搜索引擎登录入口
  • 湖南省金力电力建设有限公司 网站新闻报道最新消息今天
  • 什么网站可以做字体效果图网站seo分析工具
  • 重庆企业网站建站对网站的建议和优化
  • 做网站需要用服务器吗郑州seo关键词
  • 网站制作包括什么成都网站排名优化公司
  • 擦边球做网站挣钱字节跳动广告代理商加盟
  • 建设银行网站色调网络公司名字大全
  • 银川网站制作餐饮店如何引流与推广
  • 通过做政府门户网站的实验获得什么com天堂网
  • 网页制作免费网站百度竞价推广怎么样才有效果
  • 我国政府网站建设和管理现状seo排名优化联系13火星软件
  • 滁州市建设工程质量检测协会网站seo新手快速入门
  • 什么软件可以做dj视频网站推广运营是做什么的
  • 临沂网站设计培训班网销怎么销售的
  • 响应式网站案例互联网哪个行业前景好
  • 华夏运用网站上海网站推广优化
  • 做短链的网站企业网站seo公司