[Solved] Name of current file PHP

basename(__FILE__, ‘.php’); See also here: http://php.net/basename, or, if you like pathinfo(__FILE__, PATHINFO_FILENAME); This last one works also if the extension is different from .php without the need to specify it, see http://php.net/manual/en/function.pathinfo.php 5 solved Name of current file PHP

[Solved] How to name a file using a value in a list in a dictionary?

Something like this: dictionary = {‘results’: [{‘name’: ‘sarah’, ‘age’: ’18’}]} name = dictionary[‘results’][0][‘names’] + ‘.txt’ open(name, “w”) Opening a file in the write mode, if it doesn’t exist already, will create a new file with that name. 2 solved How to name a file using a value in a list in a dictionary?

[Solved] Find if last two characters in filename are numbers [closed]

This should do the trick. <?php $filename = “http://www.nws.noaa.gov/weather/images/fcicons/skc23.jpg”; $posOfPeriod = strrpos($filename, “.”); $last2digits = substr($filename, $posOfPeriod -2, 2); if (is_numeric($last2digits)) { echo “Numeric: “.$last2digits; } else { echo “Non-Numeric: “.$last2digits; } ?> 4 solved Find if last two characters in filename are numbers [closed]

[Solved] Splitting line on python

Let us say you have splitted_result = [‘/media/My’, ‘Passport/fileName1’] Then you can do a simple join >>> [‘ ‘.join(splitted_result)] [‘/media/My Passport/fileName1’] This will output a list as its result. solved Splitting line on python

[Solved] How to add dots between every two digits of a six digit substring?

You want to use a replace technique (in whatever language/environment you are using) on your substrings by capturing like this: (\d{2})(\d{2})(\d{2}) *note the curly brackets are for improved efficiency. And replace with: $1.$2.$3 Here is a demo link. Here is a SO page discussing the execution of replacements on nano. 1 solved How to add … Read more