Python缂栫▼瀹炵幇瀵笴odeSys涓璖T浠g爜鐨勮嚜鍔ㄦ帓鐗(涓)-CODESYS璧勬簮涓嬭浇鍖-閰峰痉缃 - CoDeSys杞欢鏁欑▼涓嬭浇,CoDeSys宸ユ帶璧勮闂ㄦ埛
HSC6490-cn涓浗鍒堕狅紝涓浗鑺瘇
鏌ョ湅: 1551|鍥炲: 1

Python缂栫▼瀹炵幇瀵笴odeSys涓璖T浠g爜鐨勮嚜鍔ㄦ帓鐗(涓)

[澶嶅埗閾炬帴]
  • TA鐨勬瘡鏃ュ績鎯
    鎿︽睏
    2019-8-13 14:13
  • 绛惧埌澶╂暟: 32 澶

    [LV.5]甯镐綇灞呮皯I

    鍙戣〃浜 2020-8-7 16:33:22 | 鏄剧ず鍏ㄩ儴妤煎眰 |闃呰妯″紡
    缁忓父浣跨敤CodeSys缂栫▼锛屼笉鍏嶈鍘荤湅鍒汉鐨勪唬鐮併
    鏈夌殑浠g爜涓牴鏈病鏈変唬鐮佺缉杩涚殑姒傚康锛岃屾湁鐨勪唬鐮佺缉杩涚殑澶锛岃屽張娌℃湁瑙勫緥锛岀湅鐫澶存檿銆
    缁欐鏌UG甯︽潵浜嗗緢澶х殑楹荤儲銆

    缃戜笂绫讳技鐨勪唬鐮佹牸寮忓寲杞欢寰堝锛屼笉涔忕簿鍝侊紝鍙槸娌℃壘鍒版敮鎸丆odeSys涓璖T璇█鐨勩傦紙鏈夌煡閬撶殑鏈嬪弸鍛婅瘔鎴戜竴澹板晩锛侊級
    姝e湪瀛︿範Python锛屾墍浠ヨ嚜宸辫瘯鐫鍐欎簡涓涓▼搴忥紝瀹炵幇浠g爜鐨勮嚜鍔ㄦ帓鐗堛
    杩欎釜浠g爜浠呬粎瀹炵幇浜咺F銆丒LSE銆丒LSIF銆丒ND_IF鐨勭缉杩涖傚悗缁鍦ㄧ爺绌朵腑...

    浠g爜鐨勫疄鐜板緢绠鍗曪紝鏂规硶涔熸瘮杈冪...
    绗竴姝ワ細浣跨敤string妯″潡涓殑strip鍑芥暟锛屽垹闄ゆ瘡涓琛岀殑琛岄鍜岃灏剧殑绌烘牸
    绗簩姝ワ細璁$畻鍝浠g爜涓嚭鐜颁簡IF銆丒LSE銆丒LSIF銆丒ND_IF绛夊叧閿瓧锛屾牴鎹叧閿瓧鐨勪笉鍚岃繘琛屼笉鍚岀殑缂╄繘銆
    鍙槸涓涓兂娉曪紝鍚庣画鐗堟湰寰呮櫄涓婂洖瀹剁户缁爺绌.... O(鈭鈭)O~
    [Python] 绾枃鏈煡鐪 澶嶅埗浠g爜
      #coding:gb2312
       import string
      text = open("test1.txt",'r')
      text1 = text.readline()
      lst1 = []
       #---------------------------------
      #鍒犻櫎琛岄鍜岃鏈殑绌烘牸
       while (text1 != ''):
        #print text1
        lst1.append(string.strip(text1))
       text1 = text.readline()
     
     indent = 0
      for i in lst1:
       if i[:3] == 'IF ':
         i = ' '*indent + i
         indent += 2
       elif (i[:5] == 'ELSE ')or (i[:5] == 'ELSE') :
         indent -= 2
         i = ' '*indent + i
         indent += 2
       elif (i[:7] =='END_IF ') or (i[:7] =='END_IF'):
         indent -= 2
         i = ' '*indent + i
       else:
         i = ' '*indent + i
       print i

    鐐硅瘎

    妤间富浣犲ソ锛屾垜涔熷Codesys缂栬緫鍣ㄤ笉鍙嬪ソ鎰熷埌鐑︽伡锛屾垜鏇剧粡鍋氳繃涓娆捐嚜瀹氫箟缂栬緫鍣紝Git寮婧愰」鐩甋cintilla.鍙互瀹炵幇璇硶鑷姩缂╄繘鍙婇珮浜樉绀轰唬鐮佹彁绀  鍙戣〃浜 2020-8-24 17:38
    +10
    涓嶈禐涓涓紵
    鎵撹祻榧撳姳涓涓嬶紒
    鍥炲

    浣跨敤閬撳叿 涓炬姤

    鎮ㄩ渶瑕佺櫥褰曞悗鎵嶅彲浠ュ洖甯 鐧诲綍 | 绔嬪嵆娉ㄥ唽 鏂版氮寰崥鐧婚檰

    鏈増绉垎瑙勫垯

    椤堕儴qrcode搴曢儴
    鍏虫敞閰峰痉缃戣闃呭彿锛岃幏鍙栨洿澶氳祫璁紒

    QQ|灏忛粦灞|鎵嬫満鐗|Archiver|閰峰痉璁哄潧 ( 鑻廔CP澶16065247鍙-1 )|缃戠珯鍦板浘

    GMT+8, 2024-11-23 19:45 , Processed in 0.143021 second(s), 58 queries .

    閰峰痉缃

    © 2001-2013 Hicodesys. 鎶鏈敮鎸 by 閰峰痉缃

    蹇熷洖澶 杩斿洖椤堕儴 杩斿洖鍒楄〃