line

Dictionary Word counter

丶灬走出姿态 提交于 2020-01-29 06:26:10
Q: Here’s something to stop you from getting repetitive when writing essays. Write a program that reads multiple lines of plain text from the user, then prints out each different word in the input with a count of how many times that word occurs. Don’t worry about punctuation or case – the input will just be words, all in lower case. Your output should list the words in alphabetical order. For example: Enter line : which witch Enter line : is which Enter line : is 1 which 2 witch 1 A??: dic_line1 = { } dic_line2 = { } list = [ ] enter_line = input ( "Enter line: " ) . lower ( ) while enter_line

ImportError: cannot import name 'PILLOW_VERSION'

筅森魡賤 提交于 2020-01-29 05:47:12
ImportError: cannot import name ‘PILLOW_VERSION’ 1. 问题 torchvision 模块内import pillow的时候发现找不到PILLOW_VERSION, 但是已经安装了pip3 install pillow==7.0.0,默认最新版本为7.0.0 2. 错误信息 File "eval.py" , line 10, in < module > import model File "/home/ternence_hsu/test/python_torch/model.py" , line 2, in < module > import torchvision File "/usr/local/lib/python3.5/dist-packages/torchvision/__init__.py" , line 4, in < module > from torchvision import datasets File "/usr/local/lib/python3.5/dist-packages/torchvision/datasets/__init__.py" , line 9, in < module > from .fakedata import FakeData File "/usr/local/lib/python3

PAT 1014

ぃ、小莉子 提交于 2020-01-29 01:43:51
1014 Waiting in Line (30分) Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are: The space inside the yellow line in front of each window is enough to contain a line with M customers. Hence when all the N lines are full, all the customers after (and including) the (NM+1)st one will have to wait in a line behind the yellow line. Each customer will choose the shortest line to wait in when crossing the yellow line. If there are two or more lines with the same

细节性的错误

自闭症网瘾萝莉.ら 提交于 2020-01-28 23:25:36
ERROR exception 135 Internal Server Error: /apple/login/ Traceback (most recent call last): File "/home/python/.virtualenvs/py3/lib/python3.5/site-packages/django/core/handlers/exception.py", line 41, in inner response = get_response(request) File "/home/python/.virtualenvs/py3/lib/python3.5/site-packages/django/core/handlers/base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request) File "/home/python/.virtualenvs/py3/lib/python3.5/site-packages/django/core/handlers/base.py", line 185, in _get_response response = wrapped_callback(request, *callback_args,

python 安装 pymssql 库时报错

老子叫甜甜 提交于 2020-01-27 08:05:49
python 安装 pymssql 库时报错 安装第三方库 pip install pymssql Traceback (most recent call last): File “c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip_vendor\urllib3\response.py”, line 425, in _error_catcher yield File “c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip_vendor\urllib3\response.py”, line 507, in read data = self._fp.read(amt) if not fp_closed else b"" File “c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\pip_vendor\cachecontrol\filewrapper.py”, line 62, in read data = self.__fp.read(amt) File “c:\users\XXX\appdata\local

计算机缓存Cache以及Cache Line详解

谁说胖子不能爱 提交于 2020-01-26 06:22:24
目录 1、计算机存储体系简介 2、计算机缓存 Cache 2.1、Cache 概述 2.2、Cache 结构 3、计算机缓存行 ChaceLine 1、计算机存储体系简介 存储器是分层次的,离CPU越近的存储器,速度越快,每字节的成本越高,同时容量也因此越小。寄存器速度最快,离CPU最近,成本最高,所以个数容量有限,其次是高速缓存(缓存也是分级,有L1,L2等缓存),再次是主存(普通内存),再次是本地磁盘。 寄存器的速度最快,可以在一个时钟周期内访问,其次是高速缓存,可以在几个时钟周期内访问,普通内存可以在几十个或几百个时钟周期内访问。 存储器分级,利用的是局部性原理。我们可以以经典的阅读书籍为例。我在读的书,捧在手里(寄存器),我最近频繁阅读的书,放在书桌上(缓存),随时取来读。当然书桌上只能放有限几本书。我更多的书在书架上(内存)。如果书架上没有的书,就去图书馆(磁盘)。我要读的书如果手里没有,那么去书桌上找,如果书桌上没有,去书架上找,如果书架上没有去图书馆去找。可以对应寄存器没有,则从缓存中取,缓存中没有,则从内存中取到缓存,如果内存中没有,则先从磁盘读入内存,再读入缓存,再读入寄存器。 2、计算机缓存 Cache 本系列的文章重点介绍缓存cache。了解如何获取cache的参数,了解缓存的组织结构。 2.1、Cache 概述 cache,中译名高速缓冲存储器

Convert date format without timezone - Google app script (Javascript), Google spreadsheet

不问归期 提交于 2020-01-26 03:56:45
问题 I'm working on integration between Google spreadsheet and LINE Message API (BOT) where Google app script is back-end. I get the date-format cell from Google spreadsheet and send to LINE bot but the message reply showed different thing. in a cell of Google Spreadsheet 1/5/2020 In Google app script, I first coded it var colb = ss.getSheets()[0].getRange(i+3, 2).getValue(); but LINE message, it sends format included timezone as default Sun Jan 05 2020 00:00:00 GMT+0700 (ICT) So I coded it var

Python 逐行读取文件并处理

喜夏-厌秋 提交于 2020-01-26 01:08:28
文章目录 1. 逐行读取文件并处理 1. 逐行读取文件并处理 # Open a file filepath = 'D:\\temp\\test.txt' fileObj = open ( filepath , "r" , encoding = 'utf8' ) for line in fileObj . readlines ( ) : print ( line ) fileObj . close ( ) 要点说明: 文件路径如果是windows系统, 反斜杠需要转义 读取文件时, 如果文件是utf8编码的, 需要指定encoding 来源: CSDN 作者: WJ.CAI 链接: https://blog.csdn.net/laresc/article/details/103757937

Drawing a straight line iOS

北城余情 提交于 2020-01-23 04:17:28
问题 I am drawing a straight line using this code (on user touch obviously) and I need to display the straight line from the start point until where the user is holding the touch (not ended the touch) like a rubber band from the start point, following the finger wherever it moves. I might have overlooked something I need to modify to create the necessary effect. Any idea? NOTE : I am inside a View Controller. - (void) drawLine:(UIPanGestureRecognizer *)sender { NSLog(@"Sender : %@", sender);

python读写文件

二次信任 提交于 2020-01-22 21:57:11
f = open("./data/test.txt","r") lines = f.readlines() for line in lines: print(line) UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 2729: illegal multibyte sequence 解决方案: f = open("./data/happy.txt", "r", encoding='utf-8') 来源: https://www.cnblogs.com/lucifer1997/p/12229733.html