- 博客(13)
- 收藏
- 关注
原创 在c++中判断文件是否存在,如存在将其删除
#include <string> #include <io.h> //在c++中判断文件是否存在,如存在将其删除 int main() { std::string rmseFile = "rmse.txt"; if (_access(rmseFile.c_str(), 0) == 0) //文件存在 { if (remove(rmseFile.c_str()) == 0) { printf("删...
2021-05-23 21:38:06
1824
1
原创 记录一些奇怪的问题(Visual Studio)
单纯做个记录,记录犯傻问题的记录本 1.文件重定向:从文件中读取数据/记录输出数据到文件,设置路径为:项目→属性→配置属性→调试→命令参数 输入用<,输出用>,两条指令间用空格隔开 在文件重定向(从文件中读取数据/记录输出数据到文件)时,注意编译的平台和设置项目属性的平台是否一致。 2.快捷键的设置与查看:路径:工具->选项->环境->键盘 2.1. 注释(块注释选中要注释的内容(取消注释同样要先选中),行注释将光标定位到该行即可) 注释:Ctrl+..
2021-05-03 20:37:14
203
原创 爬虫入门-爬取有道在线翻译结果(2)
由于服务器会识别访问的对象是否为代码并加以限制,所以需要加上一定的措施隐藏代码身份。以上节有道为例:1、添加headers信息:在生成request对象时添加headers信息中的User-Agent属性信息,模仿网页端用户。注意有两种方法,header信息要么在request对象生成前给出,要么在生成之后用add_header()函数添加上去import urllib.request impor...
2018-04-03 00:49:25
1150
原创 爬虫入门-爬取有道在线翻译结果(1)
参考小甲鱼的视频,爬取有道在线翻译结果注意:原视频中的request url地址目前已被反爬虫,不过将地址中的_o删除后就可以实现爬虫(截至2018.4.2),查找网络,貌似是还未封闭的旧接口。import urllib.request import urllib.parse content=input('请输入需要翻译的内容:') url='http://fanyi.youdao.com/tr...
2018-04-02 18:17:14
1004
1
原创 笨办法学python笔记:习题14 提示和传递(结合input)
from sys import argv#导入参数模块,import-导入模组(库)script,first,second,third=argv#解包:将每个参数赋予一个变量名 print("The script is called:",script) print("Your first variable is:",first) print("Your second variable is:",se
2018-02-27 15:21:03
548
原创 笨办法学python笔记:习题12 提示别人(pydoc和help使用)
age = input("How old are you? ") height = input("How tall are you? ") weight = input("How much do you weigh? ") #明确了a=input("提示")的用法print("So, you're %s old, %s tall and %s heavy."%(age,height,weight))
2018-02-25 23:22:07
1104
原创 笨办法学python笔记:习题11 提问(input()函数使用)
print("How old are you?",end=' ')#间隔为一个空格,不换行 age=input() print("How tall are you?",end=' ') height=input() print("How much do you weight?",end=' ') weight=input() print("So, you're %s old, %s tall a...
2018-02-25 19:44:03
845
原创 笨办法学python笔记:习题10 那是什么(转义字符)
#字符串中转义字符的使用 tabby_cat="\tI'm tabbed in."#制表符 persian_cat="I'm splited\non a line."#换行符 backslash_cat="I'm \\ a \\ cat"#反斜杠fat_cat=""" I'll do a list: \t* Cat food \t* Fishies \t* Catnip\n\t* Grass """
2018-02-25 18:52:10
551
原创 笨办法学python笔记:习题9 打印,打印,打印
# Here's some new strange stuff, remember type it exactly.days="Mon Tue Wed Thu Fri Sat Sun" months="Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"#加上换行print("Here are the days:",days) print("Here are the mon
2018-02-25 14:17:08
383
1
原创 笨方法学python笔记:习题8 打印,打印
formatter="{} {} {} {}"#空格隔开 ''' str.format()函数:通过{}和:来代替%,用于格式化字符串 ''' print(formatter.format(1, 2, 3, 4)) print(formatter.format("one", "two", "three", "four")) print(formatter.format(True, False, Fa
2018-02-25 13:25:30
322
原创 笨方法学python笔记:习题7 更多打印
这本书好像还是比较墨迹一点哈哈 例程: print("Marry had a little lamb.") print("It's fleece was white as %s."%'snow') print("And everything that Mary went.") print("."*10)#这在干嘛?重复打印:字符串*数字 end1="C" end2="h" end
2018-02-24 12:14:30
240
原创 开始我的前端学习之旅
最近开始学html,就从这里开始记录自己的进程吧。 ------------------------------------------------------------------------------
2016-11-06 16:55:00
263
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅