需要帮助将文本转换为csv格式 [英] Need help converting text to csv format

查看:66
本文介绍了需要帮助将文本转换为csv格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们。我正在制作一个小程序来帮助我的妻子将她的优惠券编入她的/ b / b
。我找到了一个很好的资源但需要帮助格式化

文本数据,以便我可以将它导入到mysql数据库中。这是

数据格式:


409220000003 Life Fitness Products $ 1(12-13-08)(CVS)

546500181141 Oust Air Sanitizer,任意B1G1F最高$ 3.49(1-17-09).35



518000159258 Pillsbury Crescent晚餐卷,任意.25(2-14) -09)

518000550406 Pillsbury冷冻大饼干,肉桂卷,迷你

肉桂卷等.40(2-14-09)

第一个值(大数字)是UPC,下一个元素是

优惠券描述,后面是括号中的日期。这些只是我关心的三个元素。

。有人可以帮我吗

重新格式化:

409220000003 Life Fitness Products $ 1(12-13-08)(CVS)

546500181141 Oust Air Sanitizer,任意B1G1F最高$ 3.49(1-17-09).35



518000159258 Pillsbury Crescent晚餐卷,任意.25(2-14) -09)

518000550406 Pillsbury冷冻大饼干,肉桂卷,迷你

肉桂卷等.40(2-14-09)

就像这样:


" 409220000003"," Life Fitness Products $ 1"" 12-13-08"

546500181141,Oust Air Sanitizer,任何B1G1F最高$ 3.49,1-17-09

" 518000159258",Pillsbury Crescent晚餐卷,任何.25"," 2-14-09"

" 518000550406",Pillsbury Frozen Grands Biscuits,Cinnamon Rolls,Mini

肉桂卷等。 40"," 2-14-09"


任何帮助,伪代码或任何pu在正确的方向sh将

最受赞赏。我是一名新手Python程序员,但我确实有一个很好的PHP编程经验。


感谢您的时间....

解决方案

1(12-13-08)(CVS)

546500181141 Oust Air Sanitizer,任何B1G1F最高

< br>

3.49(1-17-09).35
每个


518000159258 Pillsbury Crescent晚餐卷,任何.25(2-14-09)

518000550406 Pillsbury冷冻大饼干,肉桂卷,迷你

肉桂卷等.40(2-14-09)


第一个值(大数字)是UPC,下一个元素是

优惠券描述,后面是括号中的日期。这些只是我关心的三个元素。

。有人可以帮我吗

重新格式化:

409220000003 Life Fitness Products


1(12-13-08 )(CVS)

546500181141 Oust Air Sanitizer,任何B1G1F最高


Hey guys. I''m working on a little program to help my wife catalog her/
our coupons. I found a good resource but need help formatting the
text data so that I can import it into a mysql database. Here''s the
data format:

409220000003 Life Fitness Products $1 (12-13-08) (CVS)
546500181141 Oust Air Sanitizer, any B1G1F up to $3.49 (1-17-09) .35
each
518000159258 Pillsbury Crescent Dinner Rolls, any .25 (2-14-09)
518000550406 Pillsbury Frozen Grands Biscuits, Cinnamon Rolls, Mini
Cinnamon Rolls, etc. .40 (2-14-09)

The first value (large number) is the UPC, the next element is the
coupon description, followed by a date in parenthesis. Those are the
only three elements I am concerned with. Can someone help me in
reformatting this:

409220000003 Life Fitness Products $1 (12-13-08) (CVS)
546500181141 Oust Air Sanitizer, any B1G1F up to $3.49 (1-17-09) .35
each
518000159258 Pillsbury Crescent Dinner Rolls, any .25 (2-14-09)
518000550406 Pillsbury Frozen Grands Biscuits, Cinnamon Rolls, Mini
Cinnamon Rolls, etc. .40 (2-14-09)

into something like this:

"409220000003","Life Fitness Products $1","12-13-08"
"546500181141","Oust Air Sanitizer, any B1G1F up to $3.49","1-17-09"
"518000159258","Pillsbury Crescent Dinner Rolls, any .25","2-14-09"
"518000550406","Pillsbury Frozen Grands Biscuits, Cinnamon Rolls, Mini
Cinnamon Rolls, etc. .40","2-14-09"

Any help, pseudo code, or whatever push in the right direction would
be most appreciated. I am a novice Python programmer but I do have a
good bit of PHP programming experience.

Thanks for your time....

解决方案

1 (12-13-08) (CVS)
546500181141 Oust Air Sanitizer, any B1G1F up to


3.49 (1-17-09) .35
each
518000159258 Pillsbury Crescent Dinner Rolls, any .25 (2-14-09)
518000550406 Pillsbury Frozen Grands Biscuits, Cinnamon Rolls, Mini
Cinnamon Rolls, etc. .40 (2-14-09)

The first value (large number) is the UPC, the next element is the
coupon description, followed by a date in parenthesis. Those are the
only three elements I am concerned with. Can someone help me in
reformatting this:

409220000003 Life Fitness Products


1 (12-13-08) (CVS)
546500181141 Oust Air Sanitizer, any B1G1F up to


这篇关于需要帮助将文本转换为csv格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆