上班时间通过浏览器打开股票网站怕会被别人看到,没关系,试试在命令行下执行代码看数据就行了。
输入sh,就可以查看到上证指数
输入sz,就可以查看深圳指数
输入cyb,就可以查看创业板指数
其他的股票代码可以自己自定义,加入到字典中就行了
python版本2.7.3
#!/usr/bin/env python # -*- coding: utf-8 -*- import urllib2 import re import datetime def getStockInfo(url): """根据url获取信息""" stockList = [] request = urllib2.Request(url) response = urllib2.urlopen(request) stockStr = response.read() stockList = stockStr.split(',') return stockList def printStock(List): """打印相关信息""" print '***********price*****************' + List[1] print '***********float_price***********' + List[2] print '***********float_perct***********' + List[3] + '%' print '***********succ_unit*************' + List[4]+' shou' print '***********succ_price************' + List[5] def getUrlByCode(code): """根据代码获取详细的url""" url = '' stockCode = '' if code == 'sh': url = 'http://hq.sinajs.cn/list=s_sh000001' elif code == 'sz': url = 'http://hq.sinajs.cn/list=s_sz399001' elif code == 'cyb': url = 'http://hq.sinajs.cn/list=s_sz399006' else: pattern = re.compile(r'^60*') match = pattern.match(code) if match: stockCode = 'sh'+ code else: stockCode = 'sz' + code url = 'http://hq.sinajs.cn/list=s_'+stockCode return url #输入stock代码输出对应的价格信息 #code = raw_input('code: ') codeDict = { 'sh' : 'shang hai zq', 'sz' : 'shen zheng zq', 'cyb' : 'chang ye ban', '601788' : 'guang da zheng quan', '000651' : 'ge li dian qi', } #http://hq.sinajs.cn/list=s_sh000001 (上海大盘查询) #http://hq.sinajs.cn/list=s_sz399001 (深圳大盘查询) count = 0; while (count<=100):#循环100次后再退出 # 循环字典 for key in codeDict: print key + '--'+codeDict[key] code = raw_input('please select a code: ') now_time = datetime.datetime.now() #打印该code的信息 url = getUrlByCode(code) stockInfo = getStockInfo(url) #print stockInfo printStock(stockInfo) end_time = datetime.datetime.now() costTime = (end_time - now_time).seconds print '总共花费时间'+str(costTime)+'秒' count +=1

Arraysinpython,尤其是Vianumpy,ArecrucialInsCientificComputingfortheireftheireffertheireffertheirefferthe.1)Heasuedfornumerericalicerationalation,dataAnalysis和Machinelearning.2)Numpy'Simpy'Simpy'simplementIncressionSressirestrionsfasteroperoperoperationspasterationspasterationspasterationspasterationspasterationsthanpythonlists.3)inthanypythonlists.3)andAreseNableAblequick

你可以通过使用pyenv、venv和Anaconda来管理不同的Python版本。1)使用pyenv管理多个Python版本:安装pyenv,设置全局和本地版本。2)使用venv创建虚拟环境以隔离项目依赖。3)使用Anaconda管理数据科学项目中的Python版本。4)保留系统Python用于系统级任务。通过这些工具和策略,你可以有效地管理不同版本的Python,确保项目顺利运行。

numpyarrayshaveseveraladagesoverandastardandpythonarrays:1)基于基于duetoc的iMplation,2)2)他们的aremoremoremorymorymoremorymoremorymoremorymoremoremory,尤其是WithlargedAtasets和3)效率化,效率化,矢量化函数函数函数函数构成和稳定性构成和稳定性的操作,制造

数组的同质性对性能的影响是双重的:1)同质性允许编译器优化内存访问,提高性能;2)但限制了类型多样性,可能导致效率低下。总之,选择合适的数据结构至关重要。

到CraftCraftExecutablePythcripts,lollow TheSebestPractices:1)Addashebangline(#!/usr/usr/bin/envpython3)tomakethescriptexecutable.2)setpermissionswithchmodwithchmod xyour_script.3)

numpyArraysareAreBetterFornumericalialoperations andmulti-demensionaldata,而learthearrayModuleSutableforbasic,内存效率段

numpyArraySareAreBetterForHeAvyNumericalComputing,而lelethearRayModulesiutable-usemoblemory-connerage-inderabledsswithSimpleDatateTypes.1)NumpyArsofferVerverVerverVerverVersAtility andPerformanceForlargedForlargedAtatasetSetsAtsAndAtasEndCompleXoper.2)

ctypesallowscreatingingangandmanipulatingc-stylarraysinpython.1)usectypestoInterfacewithClibrariesForperfermance.2)createc-stylec-stylec-stylarraysfornumericalcomputations.3)passarraystocfunctions foreforfunctionsforeffortions.however.however,However,HoweverofiousofmemoryManageManiverage,Pressiveo,Pressivero


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

适用于 Eclipse 的 SAP NetWeaver 服务器适配器
将Eclipse与SAP NetWeaver应用服务器集成。

DVWA
Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

记事本++7.3.1
好用且免费的代码编辑器

VSCode Windows 64位 下载
微软推出的免费、功能强大的一款IDE编辑器