How to unnest a nested list

Use itertools.chain: itertools.chain(*iterables): Make an iterator that returns elements from the first iterable until it is exhausted, then proceeds to the next iterable, until all of the iterables are exhausted. Used for treating consecutive sequences as a single sequence. Example: The output is:

How to do scanf for single char in C

The %c conversion specifier won’t automatically skip any leading whitespace, so if there’s a stray newline in the input stream (from a previous entry, for example) the scanf call will consume it immediately. One way around the problem is to put a blank space before the conversion specifier in the format string: The blank in the format string tells scanf to … Read more

How to validate phone number using PHP?

Since phone numbers must conform to a pattern, you can use regular expressions to match the entered phone number against the pattern you define in regexp. php has both ereg and preg_match() functions. I’d suggest using preg_match() as there’s more documentation for this style of regex. An example

How to verify CuDNN installation?

Installing CuDNN just involves placing the files in the CUDA directory. If you have specified the routes and the CuDNN option correctly while installing caffe it will be compiled with CuDNN. You can check that using cmake. Create a directory caffe/build and run cmake .. from there. If the configuration is correct you will see these lines: If everything is … Read more