Read and write files with ‘with’ statement in Python

I always keep forgetting how exactly with statement works with opening and reading the files in Python. path = ‘./path/filename.txt’ with open(path,’r’) as file: data = file.readlines() print(data) Or if you would like to avoid getting ‘\n’ after each line when using .readlines() you can use this instead: data = file.read().splitlines() Opening files with ‘with’ … Read more

Windows 10 license types – Everything you need to know

Microsoft offers a number of different software license types, with varying degrees of flexibility and versatility. It can be hard to keep track of all the different options available to you, which is why we’ve compiled this list of Windows license types — the differences between each one, and what you should use in your … Read more

How to iterate through dictionary in Python

First you might think in order to print dictionary values it’s enough to: for i in dict: print(i) But No. This way it’ll only print the keys. In order to print values next to the dictionary keys use: for key in dict: print(key, ‘-‘, dict[key])

How to convert list into a string in C#

1. Creating a list: var list1 = new List(); 2. Adding values to the list: foreach (int value in Enumerable.Range(1, 10)) { var item = value + 100; list1.Add(item); } 3. Converting list into a string: string msg = string.Join(“,”, ohlc.ToArray());

Why Linux is Better than Windows for Web Hosting?

1. Linux is more stable and secure than Windows If you’re a Windows user thinking about switching to Linux, you may be worried about security issues. However, the Linux operating system is actually more stable and secure than Windows. In fact, the National Institute of Standards and Technology (NIST) conducted a study on the security … Read more

Windows Server 2019 Datacenter Virtual Machine Activation Guide

Install Windows Server from the DVD or from .iso file downloaded from here Start Power Shell as administrator. Right click on Start (Windows) button in the bottom-left corner, then click “Windows PowerShell (Admin) In PowerShell type with your Activation key: slmgr.vbs /ipk *****-*****-*****-*****-***** Press Enter and restart computer Now you are ready to install HyperV … Read more