// [C++] String Concatenation // VC : suppress error messages about obsolete & deprecated functions#pragma warning(disable : 4996)#define _CRT_SECURE_NO_WARNINGS#define _CRT_SECURE_NO_WARNINGS_GLOBALS #include #include using namespace std; int main(){ // string text0 = "Hello" + "World"; // error string text1 = "Hello" "World"; cout
# immutable def func(x): print("x", hex(id(x)), x) x += 1 print("x", hex(id(x)), x) def main(): a = 1 print("a", hex(id(a)), a) func(a) print("a", hex(id(a)), a) if __name__ == '__main__': main() """ Outputa 0x67298070 1x 0x67298070 1x 0x67298090 2a 0x67298070 1""" # mutable def func(x): print("x", hex(id(x)), x) x.append(3) print("x", hex(id(x)), x) def main(): a = [1, 2] print("a", hex(id(a)),..
# Python for .NET import syssys.path.append("..\\Sharp1\\bin\\Debug") import clrclr.AddReference("Forms1") import Forms1import Systemimport System.Windows.Formsfrom PyQt5.QtWidgets import * class pyForm1(Forms1.Form1): def __init__(self): self.Text = "Python for .NET" self.button1.Click += self.pybutton1_Click self.button2.Click += self.pybutton2_Click def pybutton1_Click(self, sender, e): self...
# Python for .NET import syssys.path.append("..\\Frame1\\bin\\Debug") import clrclr.AddReference("Frame1") import Frame1import Systemimport System.Windows.Forms class pyForm1(Frame1.Form1): def __init__(self): self.Text = "Python for .NET" self.button1.Click += self.button1_Click def button1_Click(self, sender, e): self.Button1_Click(sender, e) def main(): myForm1 = pyForm1() System.Windows.Form..
# Python for .NET import clrclr.AddReference("Frame1")import Frame1import System.Windows.Forms def main(): myForm1 = Frame1.Form1() System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.Run(myForm1) if __name__ == '__main__': main() Python for .NET Referencehttp://pythonnet.github.io/https://github.com/pythonnet/pythonnethttps://github.com/pythonnet/pythonnet/wi..
# Video File Renamer# Rename video files so that various sets of video files can be sorted properly. import os def main(): path = 'd:\\Down\\z' for root, dirs, files in os.walk(path): step = 1000 / len(files) files.sort() count = 0 for item in files: prefix = "{0:0>4.0f}".format(step * count + step / 3) os.rename(os.path.join(root, item), os.path.join(root, "{0} {1}".format(prefix, item))) count..
# mutable immutable def main(): # List is mutable myList = [1, 2, 3] print(hex(id(myList)), myList) myList.append(4) print(hex(id(myList)), myList) # int is immutable myInt = 3 print(hex(id(myInt)), myInt) myInt += 1 print(hex(id(myInt)), myInt) if __name__ == "__main__": main() [Output]0x20fd3e84508 [1, 2, 3]0x20fd3e84508 [1, 2, 3, 4]0x55ce80b0 30x55ce80d0 4
# Python1.py import programimport source def main(): print("in Python1.py", __name__) program.main() source.main() if __name__ == "__main__": main() # program.py def main(): print("in program.py", __name__) if __name__ == "__main__": main() # source.py def main(): print("in source.py", __name__) if __name__ == "__main__": main()
[Python] is operator, is not operatorhttps://www.geeksforgeeks.org/difference-operator-python/ [C#] is operator, as operatorhttps://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/ishttps://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/ashttps://www.geeksforgeeks.org/c-sharp-is-operator-keyword/https://www.geeksforgeeks.org/c-sharp-as-operator-keyword/http..
[C#] verbatim stringusing System; namespace Sharp1{ class Program { static void Main(string[] args) { Console.WriteLine("c:\next\race\folder\test1.xlsx"); Console.WriteLine(@"c:\next\race\folder\test1.xlsx"); // verbatim string Console.ReadKey(); } }} [C#] interpolated stringhttps://docs.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated [C#] verbatim stringhttps://docs.mic..