Python-written C + + code comparison

Source: Internet
Author: User

1 ImportSYS2 ImportRe3 4 #argv is a list of the paths to the file5 defErase_mark (args):6Mark = Re.sub ("//*. {1,1000}/*/","", args)7Mark = Re.sub ("//. {1,1000}\n","", Mark)8Mark = Re.sub ("#. {1,1000}\n","", Mark)9     returnMarkTen  One deferase_space (args): ASpace = Args.replace (" ","") -Space = Space.replace ("\ n","") -     returnSpace the  - defshow_different (args_one,args_two): -info ="[decument One:%s decument:%s]"%(Args_one,args_two) -     Print(Info) +  -  + defdisplay (information,condition): A     ifCondition: at         Print(information[0]) -     Else: -         Print(information[1]) -  -  - defCompare_same (args_one,args_two): inCycle = Args_oneifLen (Args_one) < Len (args_two)ElseArgs_two -      forIinchRange (len (cycle)): to         ifArgs_one[i]! =Args_two[i]: + show_different (Args_one[i],args_two[i]) -Display (["Decument is alike","Decument is different"], Args_one = =args_two) the  *  $ defachieve (args):Panax NotoginsengCover = open (args["Decument_one"], mode ="R", encoding ="Utf-8") -Primary = open (args["Decument_two"], mode ="R", encoding ="Utf-8") theCover_info, Primary_info =Cover.read (), Primary.read () +Cover_info, Primary_info =Erase_mark (Cover_info), Erase_mark (Primary_info) ACover_info, Primary_info =Erase_space (Cover_info), Erase_space (Primary_info) the compare_same (Cover_info, Primary_info) +  -  $ defMain (): $     ifLen (SYS.ARGV) < 3: -First_file,second_file = input ("decoment One path:"). Strip (), input ("decoment the path:"). Strip () -     Else: theFirst_file,second_file = sys.argv[1],sys.argv[2]; -args = {"Decument_one": First_file,"Decument_two": Second_file};Wuyi achieve (args) the  -  Wu if __name__=="__main__": -Main ()

Python-written C + + code comparison

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.