<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                在做WPFMVVM中經常會遇到一些Model、ViewModel的屬性添加添加私有字段和更改通知方法來支持Binding。 比如把: public class Test { ??? public string TestData1{get; set;} ??? public string TestData2{get;set;} } 變為: public class Test : INotifyPropertyChanged { ? private string _testData1; ??? public string TestData1 ??? { ???????? get{return _testData1;} ???????? set ???????? { ????????????? _testData1 = value; ????????????? OnPropertyChanged("TestData1"); ???????? } ??? } ??? private string _testData2; ??? public string TestData2 ??? { ???????? get{return _testData2;} ???????? set ???????? { ????????????? _testData2 = value; ????????????? OnPropertyChanged("TestData2"); ???????? } ??? } } 上述工作如果在遇到很多屬性時, 會太累,而且容易出錯。 因此, 我寫了一個python的小工具,專門處理添加私有字段和更改方法通知的添加。 由于是第一次用python,中間有些知識點記下來。 1)用#注釋代碼, like:#version:1 2)用import導入其他庫, like:import re 3) re是正則表達式庫,shutil是copy或者備份文件的庫 4)class的定義, like:class YourClassName: 5)構造方法的定義, like:def __init__(selft, yourParameter): 6) 方法的定義, like:def YourMethodName(self, yourParameter): 7) self類似c、c++中的this指針 8)python中的正則表達式字符串可以用?P<your_key>來標記一個符合的值, like: pattern = "((?P<space>\s*)public\s+" testData = " ? ?public " m = re.match(pattern, testData) print(m.group('space') 如果一個測試數據的開頭有很多空格等符合\s*條件的, 我們可以用space作為關鍵字來索引到具體空格。此示例中為4個空格 9)字符串的格式化可以用“%(your_key)s”%{'your_key':your_value}, like: self.classPattern = "(\s*public\s+%(class)s\s+%(derived)s\s+%(colon)s+\s*%(base)s)"%{'class':"class", 'derived':"\w+", 'colon':":", 'base':self.baseClassName} 10)如果字符串跨行, 請在字符串行尾加上\ 11)re.match()返回值若不匹配則為None 12)可以將正則表達式的匹配結果轉為字典, like: m = re.match(pattern, testData) yourDict = m.groupdict() 13)可以用raise Exception("Your exception information")來拋出異常 14)用lower()來將字符串轉為小寫 15)用replace(old, new, length)來替換字符串, 并且可以指定替換幾個 16)用input()可以接受控制臺輸入 17)if,else,for語句的定義: if methodName == "": ??? methodName = "OnPropertyChanged" for line in fileBackup: ??? print("Line is: %s"%line) 18)文件操作有open,write,close等方法, 其中open接受打開的方式, 比如“r+"代表為可讀寫, "w+"代表先清空源文件(若存在)再讀寫 19)可以用cxfreeze來打包py為exe文件,安裝cxfreeze后,打開命令行進入python路徑:C:\Python33\Scripts, 使用cxfreeze PropertyChanged.py --install-dir=D:/OnPropertyChanged 運行成功后,OnPropertyChanged目錄下會有exe,python33.dll以及相關依賴的pyd文件 download:http://sourceforge.net/projects/cx-freeze/?source=dlp 20)另外發現TortoiseGit和Sublime Text很好用。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看