用 Excel 将 xlsx 转 csv 后读出来变成了一行

2017-07-31 16:22:56 +08:00
 rebeccaMyKid

windows 传来一个 xlsx,然后用 mac Excel 转 csv,python 用f.readlines()读出来,变成了一个只有一个元素的 list,很迷,求指点。

['\xef\xbb\xbfrecipient-name,ship-address-1,ship-address-2,ship-city,ship-state,ship-postal-code,ship-country,ship-phone-number\rTaylor Robertson,1223 BILLIE JOHNSON LN,,GARLAND,TX,75044-5235,US,202-555-0142\rRebecca Alison Baker,921 BARTON SPRINGS RD,,AUSTIN,TX,78704-1147,US,202-555-0173\rRobert E. Sullivan,318 SUMMIT VIEW AVE SE,,SALEM,OR,97306-3001,US,202-555-0157\rTara Leap,822 KOSOTO TRL,,MEDFORD LAKES,NJ,08055-1103,US,202-555-0149\rAmber george,1291 PATRICIA DR,,CLARKSVILLE,TN,37040-7346,US,202-555-0188\rDana Fitzpatrick,23 GOLD RD,,KETCHIKAN,AK,99901-9628,US,202-555-0174\rTANIA VARGAS,1811 BASSETT ST APT 416,,DENVER,CO,80202-1014,US,202-555-0148\rLindsey N Flores,139 PERRAUD DR,,FOLSOM,CA,95630-2959,US,202-555-0129\rTata de Leon,124 CARLL DR,,BAY SHORE,NEW YORK,11706-6204,US,202-555-0158\rClara Hundley,15199 TIDEWATER TRL,TAPPAHANNOCK VIRGINIA,TAPPAHANNOCK,VIRGINIA,22560-5219,US,202-555-0163\rCarol Harmon,152 S PROSPECT AVE,,PARK RIDGE,IL,60068-5349,US,202-555-0174\rIRINA GRIBUN,273 LOHNES ROAD,,FRAMINGHAM,MA,1701,US,202-555-0188\rXin Zhang,918 DURLANE CT,,SUNNYVALE,CA,94087-4948,US,202-555-0139\rDave McFate,562 LOWER LICK CREEK RD,,LINDEN,TN,37096-5319,US,202-555-0184\rZachary Adam Kuntz,526 JONAGOLD CIR,,MECHANICSBURG,PENNSYLVANIA,17055-6496,US,202-555-0152\rKathryn Zetzer,423 NE 72ND ST APT E424,,SEATTLE,WASHINGTON,98115-5408,US,202-555-0114\rGREGG A HUESKE,1010 North Shore Drive,,HASTINGS,NE,68901,US,202-555-0188\rMarlo Kleckley,2167 RED PHEASANT DR,,VACAVILLE,CA,95687-7750,US,202-555-0183\rJoshua Stack,95 SANDHILL CT,,BRUSSELS,WI,54204-9719,US,202-555-0117\rBrenda Groseclose,1014 BARRACUDA AVE NE,,AVON,MN,56310-8675,US,202-555-0166\rAngel osorio,1053 OAKWOOD AVE APT 9,,LOS ANGELES,CA,90004-3526,US,202-555-0171\rAnthony Garlett,22 HOLLY DR,,SEEKONK,MA,02771-4614,US,202-555-0139\rtom kendris,85 GREENWAY DR,,STATEN ISLAND,NY,10301-3366,US,202-555-0170\rKimberly A Harbison,515 BELFONTE ST,,RUSSELL,KY,41169-1322,US,202-555-0171\rCasey Kent,1911 Highway 80 east,,Calhoun,Louisiana,71225,US,202-555-0175\rJILL N LITTRELL,892 TYLERTON CIR,,GRAYSLAKE,IL,60030-1197,US,202-555-0191\rCari Adams,7380 AUTUMN CT,,AVON,INDIANA,46123-7403,US,202-555-0123']

1765 次点击
所在节点    问与答
2 条回复
Mac
2017-07-31 17:03:10 +08:00
\r 就是回车啊
thedog
2017-08-01 08:49:05 +08:00
mac 下换行分隔符为\r,readlines 按\n 分隔读进来的

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/379291

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX